package com.itheima.wechat;

import com.alibaba.dubbo.config.annotation.Reference;
import com.itheima.entity.Result;
import com.itheima.pojo.Setmeal;
import com.itheima.service.SetmealService;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
@RequestMapping("/setmeal")
public class SetmealController {

    @Reference
    private SetmealService setmealService;

    // 移动端  查询所有套餐
    @RequestMapping("/getSetmeal.do")
    public Result getSetmeal(){
        List<Setmeal> setmeals = setmealService.getSetmeal();
        return Result.success("",setmeals);
    }


    //查询套餐信息
    @RequestMapping("/findById.do")
    public Result findById(Integer id){
        Setmeal setmeal = setmealService.findById(id);
        return Result.success("",setmeal);
    }

    //查询套餐信息  优化  批量插入
    @RequestMapping("/findByIdBath.do")
    public Result findByIdBath(Integer id){
        Setmeal setmeal = setmealService.findByIdBath(id);
        return Result.success("",setmeal);
    }


}
